<?php

class Database extends MySQLi {
	private $config = array();

	public function __construct(&$config) {
		if(is_array($config->config)) {
			$this->config = $config;
			parent::__construct($config->config['MySQL']['host'],$config->config['MySQL']['user'],$config->config['MySQL']['password'],$config->config['MySQL']['dbname']);
			if($this->connect_error) {
				die('Database connection could could not be set up..');
			}
			return true;
		}
		return false;
	}
	
	public function query($query) {
		$sql = str_replace("#_",$this->config->config['MySQL']['prefix'],$query);
		$query = parent::query($sql);
		
		if(empty($this->error)) {
			return $query;
		}
		return false;
	}
}

?>